//
//  ShoppingXiangQingTableViewCell.m
//  OpenYooxi_IOS
//
//  Created by YeahYes on 15/3/17.
//  Copyright (c) 2015年 com.ivyvi.ee. All rights reserved.
//

#import "ShoppingXiangQingTableViewCell.h"
#import "MainzhuyaoView.h"

@implementation ShoppingXiangQingTableViewCell{

    MainzhuyaoView *shangpin;

}

- (void)awakeFromNib {
    [super awakeFromNib];
    
    shangpin = [[MainzhuyaoView alloc] initWithFrame:CGRectMake(0, 28, kScreenWidth, 110)];
    shangpin.userInteractionEnabled = YES;
    shangpin.backgroundColor = [UIColor clearColor];
    [self.contentView addSubview:shangpin];
}

#pragma mark - 就收到数据
- (void)setTuandata:(NSArray *)tuandata{
    if(_tuandata != tuandata){
        _tuandata = tuandata;
        [self setNeedsLayout];
    }
}


#pragma mark - 刷新界面方法
- (void)layoutSubviews{
    [super layoutSubviews];

    //1.组团视图
    if(self.tuandata.count !=0){
        
        CGRect c = shangpin.frame;
        c.size.width = self.frame.size.width;
        c.size.height = 110+(4/self.tuandata.count)*110;
        if(self.tuandata.count ==4){
            c.size.height = 110;
        }else if (self.tuandata.count ==8){
            c.size.height = 110+110;
        }
        shangpin.frame = c;
        shangpin.tuanViewArray = self.tuandata;
        shangpin.hidden = NO;
        
    } else{
        shangpin.hidden = YES;
    }
    
}


- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
